<?php
define('DEBUG', 'on');
define("WEBPATH", dirname(__DIR__));

/**
 * /vendor/autoload.php是Composer工具生成的
 * shell: composer update
 */
require WEBPATH . '/../vendor/autoload.php';

/**
 * Swoole框架自动载入器初始化
 */
\Swoole\Loader::vendor_init();

$server = Swoole\Protocol\WebServer::create(__DIR__ . '/swoole.ini');
$server->setAppPath(WEBPATH . '/apps/'); // 设置应用所在的目录
$server->setDocumentRoot(WEBPATH);
$server->setLogger(new \Swoole\Log\EchoLog(__DIR__ . "/webserver.log")); // Logger
                                                                         // $server->daemonize(); //作为守护进程
$server->run(array(
		'worker_num' => 1,'max_request' => 5000,'log_file' => '/tmp/swoole.log' 
));